from django.db import models
from cart.models import CartModel
from user.models import UserModel
# Create your models here.

class AddressModel(models.Model):
    name=models.CharField(max_length=20,verbose_name='姓名')
    phone=models.CharField(max_length=11,verbose_name="电话")
    Shaddress=models.CharField(max_length=20,verbose_name="收货地址")
    address=models.CharField(max_length=100,verbose_name="详细地址")
    class Meta:
        db_table='address'

class OrderModel(models.Model):
    order=models.CharField(max_length=100,verbose_name="订单号")
    time=models.DateTimeField(auto_now_add=True,verbose_name="配送时间")
    invoice=models.BooleanField(default=False,verbose_name="是否需要发票")
    address=models.ForeignKey(AddressModel,on_delete=models.CASCADE,verbose_name='配送地址')
    price=models.IntegerField(verbose_name='商品金额')
    amount=models.IntegerField(verbose_name="实付金额")
    zf=models.CharField(max_length=10,verbose_name="支付方式")
    user=models.ForeignKey(UserModel,on_delete=models.CASCADE,verbose_name='下单人')
    class Meta:
        db_table='orders'

